//
//  NSString+Extensions.h
//  YJFinancial
//
//  Created by David Qu on 14-6-2.
//  Copyright (c) 2014年 David Qu Studio. All rights reserved.
//

#import <Foundation/Foundation.h>
#import <CommonCrypto/CommonDigest.h>

@interface NSString (Extensions)
- (NSString *)lowercaseFirstCharacter;
- (NSString *)uppercaseFirstCharacter;
//- (BOOL)isEmpty;
- (BOOL)isEmptyString;
- (NSString *)trim;
- (NSString *)trimTheExtraSpaces;
- (NSString *)escapeHTML;
- (NSString *)stringByDecodingXMLEntities;
- (NSString *)md5;
- (NSString *)md5ForUTF16;
- (CGFloat)fontSizeWithFont:(UIFont *)font constrainedToSize:(CGSize)size;
- (NSMutableArray *)tokenizationStringByNSStringEnumerationOptions:(NSStringEnumerationOptions)opts;
- (NSString *)languageForString;
- (NSMutableArray *)analyseTextOfSentences;
+ (BOOL)isStringEmpty:(NSString *)string;
+ (NSDate *)dateFromString:(NSString *)strDate format:(NSString *)strFormat;
+ (NSString *)stringFromDate:(NSDate *)date format:(NSString *)strFormat;
- (NSString *)stringWithCapitalizedFirstCharacter;
- (BOOL)isMobileNumberClassification;
- (BOOL)isValidateEmail;
- (BOOL)isValidateUrl;
- (id)vg_JSONValue;
- (id)vg_toArrayOrNSDictionary:(NSData *)jsonData;
- (NSString *)vg_URLDecodedString;
- (NSString *)vg_URLEncodedString;
- (BOOL)isPureInt:(NSString*)string;
// 判断是否为浮点型
- (BOOL)isPureFloat:(NSString*)string;
/**
 *  获得格式化后的字符串数字，如果为小数保留2位小数，如果小数点后都为0，则取整数部分
 *
 *  @return
 */
+ (NSString *)getPriceString:(NSString *)str;
+ (NSString *)getVal:(int)decimalNum val:(float)fval;
/**
 * 钱的进位算法：如1.98*0.95=1.881元 取1.89元
 */
+ (NSString *)getMoney2:(float)number;
+ (BOOL)isStringEmpty2:(NSString *)string;

- (BOOL)isOlderVersionThan2:(NSString*)otherVersion;
- (BOOL)isNewerVersionThan2:(NSString*)otherVersion;

#pragma mark 正则表达式／判断第一个是否以中文开头的方法

- (BOOL)pipeizimu:(NSString *)str;
+ (BOOL)isZhongWenFirst:(NSString *)firstStr;

- (BOOL)isIncludingEmoji;

- (instancetype)removedEmojiString;

/**
 * 钱的进位算法(更精确)：如1.98*0.95=1.881元 取1.89元
 */
+ (NSString *)getMoney3:(NSString *)dn;

/**
 *  描述：
 *  判断字符是否有字母或数字组成
 *  YES是 NO不是
 */
+ (BOOL)isEnglishOrNumbers:(NSString *)string;

@end

